Skip to content

Conversation

@MartinWheelerMT
Copy link
Collaborator

@MartinWheelerMT MartinWheelerMT commented Mar 20, 2025

What

  • Update CD template to ensure that originalText is always populated first.
  • Update tests to reflect the ordering change
  • Update CodeableConceptCdMapper to only add code translations when it is possible to map from URL to OID as anything other than an OID is not supported in the schema.
  • Update CodesSystemsUtil to return empty string if a mapping to known code system cannot be found.
  • Update test accordingly.
  • Update CodeableConceptCdMapper to create a new coding element for legacy codes, to avoid modifying an element whilst iterating a list.
  • Add test for an unknown code system.
  • SonarCube fix to remove public modifier on test class.
  • Fix error in "Medications" test file, where a legacy code contains a space, which is not valid according to the schema.

Why

The imports were failing on EMIS due to schema validation issues, looking at the schema:

   <xsd:complexContent>
            <xsd:extension base="ANY">
                <xsd:sequence>
                    <xsd:element name="originalText" type="ED" minOccurs="0">
                        <xsd:annotation>
                            <xsd:documentation> The text or phrase used as the basis for the coding. </xsd:documentation>
                            <xsd:appinfo />
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element name="qualifier" type="CR" minOccurs="0" maxOccurs="unbounded">
                        <xsd:annotation>
                            <xsd:documentation> Specifies additional codes that increase the
                                specificity of the primary code. </xsd:documentation>
                            <xsd:appinfo />
                        </xsd:annotation>
                    </xsd:element>
                    <xsd:element name="group" minOccurs="0" maxOccurs="unbounded">
                        <xsd:complexType>
                            <xsd:sequence>
                                <xsd:element name="qualifier" type="CR" maxOccurs="unbounded" />
                            </xsd:sequence>
                        </xsd:complexType>
                    </xsd:element>
                    <xsd:element name="translation" type="CD" minOccurs="0" maxOccurs="unbounded">
                        <xsd:annotation>
                            <xsd:documentation> A set of other concept descriptors that translate
                                this concept descriptor into other code systems. </xsd:documentation>
                            <xsd:appinfo />
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
...

It appears that the originalText field should be appearing first in the sequence ahead of the translations.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have performed a self-review of my code
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

…CD XML

* Update CD template to ensure that `originalText` is always populated first.
* Update tests to reflect the ordering change
@MartinWheelerMT MartinWheelerMT changed the title NIAD-3304: NIAD-3304: Ensure correct ordering of originalText when mapping CodeableConcept to CD Mar 20, 2025
…CD XML

* Update `CodeableConceptCdMapper` to only add code translations when it is possible to map from URL to OID as anything other than an OID is not supported in the schema.
* Update CodesSystemsUtil to return empty string if a mapping to known code system cannot be found.
* Update test accordingly.
…CD XML

* Update `CodeableConceptCdMapper` to create a new coding element for legacy codes, to avoid modifying an element whilst iterating a list.
…CD XML

* Add test for an unknown code system.
* SonarCube fix to remove public modifier on test class.
* Fix error in "Medications" test file, where a legacy code contains a space, which is not valid according to the schema.
@github-actions
Copy link

Looks good. All 5 mutations in this change were killed.

class surviving killed
💯uk.nhs.adaptors.gp2gp.ehr.mapper.CodeableConceptCdMapper 0 4
💯uk.nhs.adaptors.gp2gp.ehr.utils.CodeSystemsUtil 0 1

See https://pitest.org

@sonarqubecloud
Copy link

@MartinWheelerMT MartinWheelerMT enabled auto-merge (squash) March 21, 2025 11:54
@MartinWheelerMT MartinWheelerMT merged commit 74c048e into main Mar 24, 2025
15 checks passed
@MartinWheelerMT MartinWheelerMT deleted the fix-ordering-of-original-text-in-cd-xml branch March 24, 2025 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants